home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / util / boot / snap_v2_0.lha / Snap / handler.s < prev    next >
Text File  |  1991-07-21  |  20KB  |  581 lines

  1.         include "exec/types.i"
  2.         include "exec/lists.i"
  3.         include "devices/inputevent.i"
  4.  
  5. waiting   equ 0
  6. selregion equ 1
  7. waitext   equ 2
  8. selgfx    equ 3
  9. waitgfx   equ 4
  10. inserting equ 5
  11. pendsnap  equ 6
  12. killbutt  equ 7
  13.  
  14. noaction  equ 0
  15. snapgfx   equ 1
  16. snaptext  equ 2
  17. snapinit  equ 3
  18. insert    equ 4
  19. cancel    equ 5
  20.  
  21. LMB       equ IECODE_LBUTTON
  22. LMB_UP    equ IECODE_UP_PREFIX+IECODE_LBUTTON
  23. RMB       equ IECODE_RBUTTON
  24. RMB_UP    equ IECODE_UP_PREFIX+IECODE_RBUTTON
  25. NO_BUTT   equ IECODE_NOBUTTON
  26. LCOM      equ IEQUALIFIER_LCOMMAND
  27. SHIFT     equ IEQUALIFIER_LSHIFT+IEQUALIFIER_RSHIFT
  28. LQ        equ IEQUALIFIER_LEFTBUTTON
  29. MQ        equ IEQUALIFIER_MIDBUTTON
  30. RQ        equ IEQUALIFIER_RBUTTON
  31. BUTTONS   equ LQ+MQ+RQ
  32.  
  33.  
  34.         XDEF    _myhandler
  35.         XREF    _geta4
  36.         XREF    _LVOSignal
  37.         XREF    _SysBase
  38.         XREF    _MyTask
  39.         XREF    _action
  40.         XREF    _state
  41.         XREF    _modinsert
  42.         XREF    _startsignal
  43.         XREF    _insertsignal
  44.         XREF    _cancelsignal
  45.         XREF    _donesignal
  46.         XREF    _movesignal
  47.         XREF    _clicksignal
  48.         XREF    _timersignal
  49.         XREF    _initsignal
  50.         XREF    _cwsignal
  51.         XREF    _ticksignal
  52.         XREF    _textqual                      ; qualifier for snapping text
  53.         XREF    _gfxqual                       ;    -"-    -"-   -"-    gfx
  54.         XREF    _insertkey
  55.         XREF    _cwkey
  56.  
  57.         SECTION CODE
  58.  
  59. _myhandler:
  60.  
  61. ; On entry: a0 : Pointer to event list
  62. ;           a1 : Pointer to data
  63.  
  64. ; In loop:  a1 : Pointer to event
  65. ;           d0 : scratch
  66.  
  67. ; Result:   d0 : New event list
  68.  
  69.         movem.l a4,-(sp)
  70.  
  71.         jsr     _geta4                         ; Get offset base a4
  72.  
  73.         move.l  a0,a1                          ; a1 = Event list = a0
  74.  
  75. .nextevent
  76.         cmpa.l  #0,a1                          ; Check for end of list
  77.         beq     .done
  78.  
  79.         cmp.w   #noaction,_action              ; forced noaction - cancel
  80.         bne     .notcanceled                   ; no, we're in action
  81.         move.w  #waiting,_state                ; no action -> wait state
  82.         bra     .dostate
  83. .notcanceled
  84.         cmp.w   #insert,_action                ; forced insert - cancel
  85.         bne     .dostate                       ; no
  86.         move.w  #inserting,_state              ; set correct state
  87.  
  88. .dostate
  89.         move.w  _state,d0
  90.         asl.w   #1,d0
  91.         move.w  JumpTable(pc,d0.w),d0
  92. Origin
  93.         jmp     0(pc,d0.w)
  94. JumpTable
  95.         dc.w    .Waiting-Origin-2
  96.         dc.w    .SelRegion-Origin-2
  97.         dc.w    .WaitExt-Origin-2
  98.         dc.w    .SelGfx-Origin-2
  99.         dc.w    .WaitGfx-Origin-2
  100.         dc.w    .Insert-Origin-2
  101.         dc.w    .PendSnap-Origin-2
  102.         dc.w    .CancelTxt-Origin-2
  103.  
  104. ; ********************************************************
  105. ; State: Waiting    ~TQ
  106. ; Actions     New state             Signal
  107. ; TQ          PendSnap              init
  108. ; LMB+GQ      SelGfx                init+start
  109. ; LCOM+IKEY   Inserting             insert
  110.  
  111. .Waiting
  112.         cmp.b   #IECLASS_RAWKEY,ie_Class(a1)   ; Is it RAWKEY?
  113.         bne     .wait_RAWMOUSE
  114.  
  115.         move.w  ie_Qualifier(a1),d0
  116.         and.w   _textqual,d0                   ; Mask out unwanted quals
  117.         cmp.w   _textqual,d0                   ; Is it TQ?
  118.         bne     .wait_lcom                     ; No
  119.         move.w  ie_Qualifier(a1),d0            ; Make sure that no button
  120.         and.w   #BUTTONS,d0                    ;  is down.
  121.         beq     .signalinit                    ; No buttons -- ok
  122.         bra     .EventHandled
  123.  
  124. .wait_lcom
  125.         move.w  ie_Qualifier(a1),d0
  126.         and.w   #LCOM,d0                       ; LCOM?
  127.         beq     .EventHandled                  ; No
  128.  
  129.         move.w  _cwkey,d0                      ; Control window key
  130.         cmp.w   ie_Code(a1),d0
  131.         beq     .signalcw
  132.  
  133.         move.w  _insertkey,d0
  134.         beq     .EventHandled                  ; Key = 0 -- disabled
  135.  
  136.         cmp.w   ie_Code(a1),d0                 ; The insert key?
  137.         bne     .EventHandled                  ; No, pass it on
  138.         bra     .signalinsert                  ; Tell'em to insert
  139.  
  140. .wait_RAWMOUSE
  141.         cmp.b   #IECLASS_RAWMOUSE,ie_Class(a1) ; Is it RAWMOUSE?
  142.         bne     .EventHandled                  ; Nope, pass it on
  143.  
  144.         move.w  ie_Qualifier(a1),d0
  145.         and.w   _textqual,d0                   ; Mask out unwanted quals
  146.         cmp.w   _textqual,d0                   ; Middle button TQ?
  147.         beq     .signalinit                    ; Yes
  148.  
  149.         cmp.w   #RMB,ie_Code(a1)               ; OK, is it MENUDOWN?
  150.         bne     .wait_LMB
  151.         move.w  ie_Qualifier(a1),d0
  152.         and.w   _textqual,d0                   ; Mask out unwanted quals
  153.         cmp.w   _textqual,d0                   ; TQ?
  154.         bne     .EventHandled                  ; No, not interested
  155.         bra     .signalinsert
  156.  
  157. .wait_LMB
  158.         cmp.w   #LMB,ie_Code(a1)               ; OK, is it SELECTDOWN?
  159.         bne     .EventHandled                  ; Too bad
  160.  
  161.         move.w  ie_Qualifier(a1),d0
  162.         and.w   _gfxqual,d0                    ; Mask out unwanted quals
  163.         cmp.w   _gfxqual,d0                    ; GQ?
  164.         bne     .EventHandled                  ; No, not interested
  165.  
  166. ; Handle event LMB+GQ
  167.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  168.         move.w  #snapgfx,_action               ; action snapgfx;
  169.         move.w  #selgfx,_state                 ; state selgfx
  170.         move.l  _initsignal,d0                 ; Signal init and
  171.         or.l    _startsignal,d0                ; start
  172.         bra     SignalTask
  173.  
  174. .signalinit
  175.         move.w  #pendsnap,_state
  176.         move.w  #snapinit,_action
  177.         move.l  _initsignal,d0                 ; Signal start
  178.         bsr     Signal
  179.         bra     .PendSnap
  180.  
  181.  
  182. ; *******************************************************
  183. ; State: PendSnap   TQ
  184. ; Actions     New state           Signal
  185. ; ~TQ         Waiting             cancel
  186. ; LCOM+IKEY   Inserting           insert
  187. ; LMB         SelRegion           start
  188. ; RMB         Inserting           insert
  189.  
  190. .PendSnap
  191.         cmp.b   #IECLASS_RAWKEY,ie_Class(a1)   ; RAWKEY?
  192.         bne     .ps_RAWMOUSE
  193.         move.w  ie_Qualifier(a1),d0
  194.         and.w   _textqual,d0                   ; Mask out unwanted quals
  195.         cmp.w   _textqual,d0                   ; TQ?
  196.         beq     .ps_IKEY                       ; Still down, continue
  197.  
  198. ;Handle event ~TQ
  199. .ps_TQ
  200.         move.w  #noaction,_action              ; no action
  201.         move.w  #waiting,_state                ; state waiting
  202.         move.l  _cancelsignal,d0               ; snap cancelled
  203.         bra     SignalTask
  204.  
  205. .ps_IKEY
  206.         move.w  ie_Qualifier(a1),d0
  207.         and.w   #LCOM,d0                       ; LCOM?
  208.         beq     .EventHandled                  ; No
  209.  
  210.         move.w  _cwkey,d0                      ; Control window key
  211.         cmp.w   ie_Code(a1),d0
  212.         beq     .signalcw
  213.  
  214.         move.w  _insertkey,d0
  215.         beq     .EventHandled                  ; Key = 0 -- disabled
  216.  
  217.         cmp.w   ie_Code(a1),d0                 ; The insert key?
  218.         bne     .EventHandled                  ; No, pass it on
  219.         move.w  #0,_modinsert
  220.         move.w  ie_Qualifier(a1),d0
  221.         and.w   #SHIFT,d0                      ; SHIFT?
  222.         beq     .signalinsert                  ; No
  223.         move.w  #1,_modinsert
  224. .signalinsert
  225.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  226.         move.w  #insert,_action
  227.         move.w  #inserting,_state
  228.         move.l  _insertsignal,d0               ; and insert
  229.         bra     SignalTask
  230.  
  231. .ps_RAWMOUSE
  232.         cmp.b   #IECLASS_RAWMOUSE,ie_Class(a1) ; Is it RAWMOUSE?
  233.         bne     .EventHandled                  ; Nope, pass it on
  234.  
  235.         move.w  ie_Qualifier(a1),d0            ; Might be TQ going up.
  236.         and.w   _textqual,d0                   ; Mask out unwanted quals
  237.         cmp.w   _textqual,d0                   ; TQ?
  238.         bne     .ps_TQ
  239.  
  240.         cmp.w   #LMB,ie_Code(a1)               ; OK, is it SELECTDOWN?
  241.         bne     .ps_RMB                        ; Too bad
  242.  
  243. ; Handle event LMB+TQ
  244.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  245.         move.w  #snaptext,_action              ; action snaptext
  246.         move.w  #selregion,_state              ; state selregion
  247.         move.l  _startsignal,d0                ; start
  248.         bra     SignalTask
  249.  
  250. .ps_RMB
  251.         cmp.w   #RMB,ie_Code(a1)               ; MENUDOWN
  252.         bne     .EventHandled
  253.         bra     .signalinsert
  254.  
  255. .signalcw
  256.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  257.         move.w  #noaction,_action
  258.         move.w  #waiting,_state
  259.         move.l  _cancelsignal,d0               ; Exit pending snap
  260.         or.l    _cwsignal,d0                   ; and tell'em to open window
  261.         bra     SignalTask
  262.  
  263.  
  264. ; *******************************************************
  265. ; State: SelRegion  LMB+TQ
  266. ; Actions     New state           Signal
  267. ; ~TQ         Waiting             cancel
  268. ; ~LMB        WaitExt
  269. ; MOVE        SelRegion           move
  270. ; RMB         SelRegion           click
  271. ; ~RMB        SelRegion                      Needs no action
  272. ; TIMER       SelRegion           timer
  273.  
  274. .SelRegion
  275.         cmp.b   #IECLASS_TIMER,ie_Class(a1)    ; Timer event?
  276.         bne     .sr_RAWKEY
  277.  
  278. ;Handle timer event
  279.         move.l  _ticksignal,d0
  280.         bra     SignalTask
  281.  
  282. .sr_RAWKEY
  283.         cmp.b   #IECLASS_RAWKEY,ie_Class(a1)   ; RAWKEY?
  284.         bne     .sr_LMB_UP
  285.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  286.         move.w  ie_Qualifier(a1),d0
  287.         and.w   _textqual,d0                   ; Mask out unwanted quals
  288.         cmp.w   _textqual,d0                   ; TQ?
  289.         beq     .EventHandled                  ; Still down, continue
  290.  
  291. ;Handle event ~TQ
  292. .sr_TQ
  293.         move.w  #cancel,_action                ; no action
  294.         move.w  #killbutt,_state              ; state waiting
  295.         move.l  _cancelsignal,d0               ; snap cancelled
  296.         bra     SignalTask
  297.  
  298. .sr_LMB_UP
  299.         cmp.b   #IECLASS_RAWMOUSE,ie_Class(a1) ; Is it RAWMOUSE?
  300.         bne     .EventHandled                  ; Nope, pass it on
  301.  
  302.         move.w  ie_Qualifier(a1),d0            ; Might be TQ going up.
  303.         and.w   _textqual,d0                   ; Mask out unwanted quals
  304.         cmp.w   _textqual,d0                   ; TQ?
  305.         bne     .sr_TQ
  306.  
  307.         cmp.w   #LMB_UP,ie_Code(a1)            ; SELECTUP
  308.         bne     .sr_MOVE                       ; no, check for move
  309.  
  310. ; Handle event ~LMB
  311.         move.w  #waitext,_state                ; state waitext
  312.         bra     KillEvent
  313.  
  314. .sr_MOVE
  315.         cmp.w   #NO_BUTT,ie_Code(a1)           ; MOVE
  316.         bne     .sr_RMB                        ; No, check for RMB
  317.         move.w  ie_Qualifier(a1),d0
  318.         and.w   #IEQUALIFIER_RELATIVEMOUSE,d0  ; RELATIVEMOUSE
  319.         beq     .sr_RMB
  320.  
  321. ; Handle event MOVE
  322.         move.l  _movesignal,d0
  323.         bra     SignalTask
  324.  
  325. .sr_RMB
  326.         cmp.w   #RMB,ie_Code(a1)               ; MENUDOWN
  327.         bne     .EventHandled                  ; No, not interested
  328.  
  329. ; Handle event RMB
  330.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  331.         move.l  _clicksignal,d0
  332.         bra     SignalTask
  333.  
  334. ; ***************************************************
  335. ; State WaitExt     TQ
  336. ; Actions     New state           Signal
  337. ; ~TQ         Waiting             done
  338. ; LMB         SelRegion           click
  339. ; MOVE        WaitExt                            No action needed.
  340. ; RMB         Inserting           done & insert
  341. ; TIMER       WaitExt             timer
  342.  
  343. .WaitExt
  344.         cmp.b   #IECLASS_TIMER,ie_Class(a1)    ; Timer event?
  345.         bne     .we_RAWKEY
  346.  
  347. ;Handle timer event
  348.         move.l  _ticksignal,d0
  349.         bra     SignalTask
  350.  
  351. .we_RAWKEY
  352.         cmp.b   #IECLASS_RAWKEY,ie_Class(a1)   ; RAWKEY?
  353.         bne     .we_LMB
  354.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  355.         move.w  ie_Qualifier(a1),d0
  356.         and.w   _textqual,d0                   ; Mask out unwanted quals
  357.         cmp.w   _textqual,d0                   ; TQ?
  358.         beq     .EventHandled                  ; Still down, continue
  359.  
  360. ;Handle event ~TQ
  361. .we_TQ
  362.         move.w  #noaction,_action              ; no action
  363.         move.w  #waiting,_state                ; state waiting
  364.         move.l  _donesignal,d0                 ; snap finished
  365.         bra     SignalTask
  366.  
  367. .we_LMB
  368.         cmp.b   #IECLASS_RAWMOUSE,ie_Class(a1) ; Is it RAWMOUSE?
  369.         bne     .EventHandled                  ; Nope, pass it on
  370.  
  371.         move.w  ie_Qualifier(a1),d0            ; Might be TQ going up.
  372.         and.w   _textqual,d0                   ; Mask out unwanted quals
  373.         cmp.w   _textqual,d0                   ; TQ?
  374.         bne     .we_TQ                         ; No.
  375.  
  376.         cmp.w   #LMB,ie_Code(a1)               ; SELECTDOWN
  377.         bne     .we_RMB                        ; no, check for RMB
  378.  
  379. ; Handle event LMB
  380.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  381.         move.w  #selregion,_state              ; state waitext
  382.         move.l  _clicksignal,d0                ; Extend selection
  383.         bra     SignalTask
  384.  
  385. .we_RMB
  386.         cmp.w   #RMB,ie_Code(a1)               ; MENUDOWN
  387.         bne     .EventHandled                  ; No, not interested
  388.  
  389. ; Handle event RMB
  390.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  391.         move.w  #insert,_action
  392.         move.w  #inserting,_state
  393.         move.l  _donesignal,d0
  394.         or.l    _insertsignal,d0
  395.         bra     SignalTask
  396.  
  397. ; *******************************************************
  398. ; State: SelGfx     LMB+GQ
  399. ; Actions     New state           Signal
  400. ; ~GQ         Waiting             cancel
  401. ; ~LMB        WaitGfx
  402. ; MOVE        SelGfx              move
  403. ; TIMER       SelGfx              timer
  404. ; RMB         SelGfx                        removed
  405.  
  406. .SelGfx
  407.         cmp.b   #IECLASS_TIMER,ie_Class(a1)    ; Timer event?
  408.         bne     .sg_RAWKEY
  409.  
  410. ;Handle timer event
  411.         move.l  _ticksignal,d0
  412.         bra     SignalTask
  413.  
  414. .sg_RAWKEY
  415.         cmp.b   #IECLASS_RAWKEY,ie_Class(a1)   ; RAWKEY?
  416.         bne     .sg_LMB_UP
  417.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  418.         move.w  ie_Qualifier(a1),d0
  419.         and.w   _gfxqual,d0                    ; Mask out unwanted quals
  420.         cmp.w   _gfxqual,d0                    ; GQ?
  421.         beq     .EventHandled                  ; Still down, continue
  422.  
  423. ;Handle event ~GQ
  424. .sg_GQ
  425.         move.w  #cancel,_action                ; cancelling snap
  426.         move.w  #killbutt,_state               ; Kill obsolete button
  427.         move.l  _cancelsignal,d0               ; snap cancelled
  428.         bra     SignalTask
  429.  
  430. .sg_LMB_UP
  431.         cmp.b   #IECLASS_RAWMOUSE,ie_Class(a1) ; Is it RAWMOUSE?
  432.         bne     .EventHandled                  ; Nope, pass it on
  433.  
  434.         move.w  ie_Qualifier(a1),d0            ; Might be GQ going up.
  435.         and.w   _gfxqual,d0                    ; Mask out unwanted quals
  436.         cmp.w   _gfxqual,d0                    ; GQ?
  437.         bne     .sg_GQ
  438.  
  439.         cmp.w   #LMB_UP,ie_Code(a1)            ; SELECTUP
  440.         bne     .sg_MOVE                       ; no, check for move
  441.  
  442. ; Handle event ~LMB
  443.         move.w  #waitgfx,_state                ; state waitext
  444.         bra     KillEvent
  445.  
  446. .sg_MOVE
  447.         cmp.w   #NO_BUTT,ie_Code(a1)           ; MOVE
  448.         bne     .EventHandled                  ; No, check for RMB
  449.         move.w  ie_Qualifier(a1),d0
  450.         and.w   #IEQUALIFIER_RELATIVEMOUSE,d0  ; RELATIVEMOUSE
  451.         beq     .EventHandled
  452.  
  453. ; Handle event MOVE
  454.         move.l  _movesignal,d0
  455.         bra     SignalTask
  456.  
  457. .sg_RMB
  458.         bra     KillEvent
  459.  
  460. ; ***************************************************
  461. ; State WaitGfx     GQ
  462. ; Actions     New state           Signal
  463. ; ~GQ         Waiting             done
  464. ; LMB         SelGfx              click
  465. ; MOVE        WaitGfx                            No action needed.
  466. ; TIMER       WaitGfx             timer
  467. ; RMB         WaitGfx             --             remove event
  468.  
  469. .WaitGfx
  470.         cmp.b   #IECLASS_TIMER,ie_Class(a1)    ; Timer event?
  471.         bne     .wg_RAWKEY
  472.  
  473. ;Handle timer event
  474.         move.l  _ticksignal,d0
  475.         bra     SignalTask
  476.  
  477. .wg_RAWKEY
  478.         cmp.b   #IECLASS_RAWKEY,ie_Class(a1)   ; RAWKEY?
  479.         bne     .wg_LMB
  480.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  481.         move.w  ie_Qualifier(a1),d0
  482.         and.w   _gfxqual,d0                    ; Mask out unwanted quals
  483.         cmp.w   _gfxqual,d0                    ; GQ?
  484.         beq     .EventHandled                  ; Still down, continue
  485.  
  486. ;Handle event ~GQ
  487. .wg_GQ
  488.         move.w  #noaction,_action              ; no action
  489.         move.w  #waiting,_state                ; state waiting
  490.         move.l  _donesignal,d0                 ; snap finished
  491.         bra     SignalTask
  492.  
  493. .wg_LMB
  494.         cmp.b   #IECLASS_RAWMOUSE,ie_Class(a1) ; Is it RAWMOUSE?
  495.         bne     .EventHandled                  ; Nope, pass it on
  496.  
  497.         move.w  ie_Qualifier(a1),d0            ; Might be GQ going up
  498.         and.w   _gfxqual,d0                    ; Mask out unwanted quals
  499.         cmp.w   _gfxqual,d0                    ; GQ?
  500.         bne     .wg_GQ
  501.  
  502.         cmp.w   #LMB,ie_Code(a1)               ; SELECTDOWN
  503.         bne     .wg_RMB                          ; no -- finished
  504.  
  505. ; Handle event LMB
  506.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  507.         move.w  #selgfx,_state                 ; state waitext
  508.         move.l  _clicksignal,d0                ; Extend selection
  509.         bra     SignalTask
  510.  
  511. .wg_RMB
  512.         cmp.w   #NO_BUTT,ie_Code(a1)           ; Any button?
  513.         beq     .EventHandled                  ; No, moves are ok
  514.  
  515.         bra     KillEvent
  516.  
  517.  
  518. ; ***************************************************
  519. ; State CancelTxt
  520. ; Make sure that the Button Up event that we've got
  521. ; hanging around doesn't get through.
  522.  
  523. .CancelTxt
  524.         cmp.b   #IECLASS_RAWMOUSE,ie_Class(a1) ; Is it RAWMOUSE?
  525.         bne     .EventHandled                  ; Nope, just pass it on
  526.  
  527.         cmp.w   #LMB_UP,ie_Code(a1)            ; The button?
  528.         bne     .EventHandled                  ; No
  529.  
  530.         move.w  #noaction,_action
  531.         move.w  #waiting,_state
  532.         bra     KillEvent
  533.  
  534. ; ***************************************************
  535. ; State Insert
  536. ; Snap actions are removed, the rest are passed along.
  537.  
  538. .Insert
  539.         cmp.b   #IECLASS_RAWMOUSE,ie_Class(a1) ; Is it RAWMOUSE?
  540.         bne     .EventHandled                  ; Nope, pass it on
  541.  
  542.         cmp.w   #LMB,ie_Code(a1)               ; Left mouse button
  543.         bne     .insert_TQ                     ; No -- just kill
  544.  
  545.         move.w  #noaction,_action              ; Cancel paste
  546.  
  547. .insert_TQ
  548.         move.w  ie_Qualifier(a1),d0
  549.         and.w   _textqual,d0                   ; Mask out unwanted quals
  550.         cmp.w   _textqual,d0                   ; TQ?
  551.         bne     .EventHandled                  ; no
  552.  
  553.         cmp.w   #NO_BUTT,ie_Code(a1)           ; Any button?
  554.         beq     .EventHandled                  ; No, moves are ok
  555.  
  556. KillEvent:
  557.         move.b  #IECLASS_NULL,ie_Class(a1)     ; Kill event
  558.         bra     .EventHandled
  559.  
  560. SignalTask:
  561.         bsr     Signal
  562.  
  563. .EventHandled
  564.         move.l  ie_NextEvent(a1),a1             ; Get next event
  565.         bra     .nextevent
  566.  
  567. .done
  568.         movem.l (sp)+,a4
  569.         move.l  a0,d0
  570.         rts
  571.  
  572. Signal:
  573.         movem.l a0-a2/a6,-(sp)
  574.         move.l  _MyTask,a1
  575.         move.l  _SysBase,a6                     ;  Get ExecBase for Signal
  576.         jsr     _LVOSignal(a6)
  577.         movem.l (sp)+,a0-a2/a6
  578.         rts
  579.  
  580.         end
  581.